<?php
namespace app\index\middleware;

use service\NodeService;
use think\Db;
use think\Request;

class Check
{
    public function handle($request, \Closure $next)
    {
        if ($request->isMobile()){
            $path = $request->path();
            if (empty($path)){
                return redirect(url('/m'));
            }elseif (strpos($path,'m')!==0){
                return redirect(url('/m/'.$path));
            }

        }else{

        }
        return $next($request);
    }

}
